package com.bo.Service.Impl;


import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bo.Dao.CompanyTouchDao;
import com.bo.Entity.CompanyTouch;
import com.bo.Entity.MyImage;
import com.bo.Service.CompanyTouchService;


@Service
public class CompanyTouchServiceImpl implements CompanyTouchService{


	@Autowired
	private CompanyTouchDao companyTouchDao;
	
	
	@Transactional(readOnly=true)
	public CompanyTouch getCompanyTouch(int companyId){
		
		List<CompanyTouch> list=companyTouchDao.getCompanyTouch(companyId);
		
		if(list.size()==0){
			return null;
		}else{
			
			return list.get(0);
		}
	}

	
	@Transactional
    public boolean update(CompanyTouch companyTouch){
		
		int num=companyTouchDao.update(companyTouch);
		
		if(num>0)
			return true;
		else
			return false;
	}
	
	
	@Transactional(readOnly=true)
	public void getImage(int id, MyImage image){
		
		try{
			
			companyTouchDao.getImage(id, image);
		   
		}catch(EmptyResultDataAccessException e){
			
		}
	}
	
	
}
